/*
** main.c for zappy in /home/fassi_c//zappy/zappouet/server
**
** Made by clement fassi
** Login   <fassi_c@epitech.net>
**
** Started on  Sat Jul  9 16:59:52 2011 clement fassi
** Last update Sat Jul  9 16:59:58 2011 clement fassi
*/

#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "list.h"

void my_putchar(char c)
{
  write(1, &c, 1);
}

char *init_map(int x, int y)
{
  int i = 0;
  char *blocs = malloc((x * y) * sizeof(blocs));

  srand(time(NULL));
  while (i < x * y)
    {
      blocs[i] = '.';
      i++;
    }
  return (blocs);
}

void aff_map(char *blocs, int x, int y)
{
  int i = 0;

  while (i < x * y)
    {
      my_putchar(blocs[i]);
      i++;
      if (i%x == 0)
	my_putchar('\n');
    }
}

int main(int ac, char **av)
{
  if (ac > 1)
    {
      int x = atoi(av[1]);
      int y = atoi(av[2]);
      aff_map(init_map(x, y), x, y);
    }
  return (0);
}
